package cn.licoy.wdog.core.controller.hospital;

import cn.licoy.wdog.common.annotation.SysLogs;
import cn.licoy.wdog.common.bean.ResponseCode;
import cn.licoy.wdog.common.bean.ResponseResult;
import cn.licoy.wdog.core.dto.hospitalUser.TitleDto;
import cn.licoy.wdog.core.entity.hospital.Title;
import cn.licoy.wdog.core.service.hospital.TitleService;
import com.baomidou.mybatisplus.plugins.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author Sunne
 * Create time 2018/6/22 15:42
 * @return null
 **/
@RestController
@RequestMapping(value = "/title")
@Api(tags = {"第一期--职称相关操作"})
public class TitleController {
    @Autowired
    TitleService titleService;

    @PostMapping(value = {"/verificationCode"})
    @ApiOperation(value = "新增职称")
    @SysLogs("新增职称")
    @ApiImplicitParam(paramType = "header",name = "Authorization",value = "身份认证Token")
    public ResponseResult verificationCode(@RequestBody @Validated @ApiParam(value = "职称") TitleDto TitleDto){
        titleService.add(TitleDto);
        return ResponseResult.e(ResponseCode.OK,"操作成功");
    }

    @PostMapping(value = {"/selectall"})
    @ApiOperation(value = "查询所有职称")
    @SysLogs("查询所有职称")
    @ApiImplicitParam(paramType = "header",name = "Authorization",value = "身份认证Token")
    public ResponseResult selectAll(){
        Page<Title> pd = titleService.selectPage(new Page<>(0,80));
        return ResponseResult.e(ResponseCode.OK,pd);
    }

}
